class student{
    public String name="张三";
    public int age;

    public static String classRoom="101";

    private static int size;

    static {
        System.out.println("静态代码块——》初始化静态的数据成员/提前准备数据");
    }

    {
        name="李四";
        System.out.println("非静态代码块/实例代码块/构造代码块——》初始化非静态的数据成员");
    }

    public student(){
        System.out.println("不带参的构造方法！");
    }

    public student(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("带两个参数的构造方法！");
    }

    public student(String name, int age,int s1) {
        this.name = name;
        this.age = age;
        size = s1;
    }

    public static void setsize(int size){
        student.size=size;
    }

    public static int getsize(){
        return size;
    }

    public void doclass(){
        System.out.println(name+"在上课！");
    }

    public static void func(){
//        System.out.println(this.name);
//        System.out.println(name);
//        //error！！！

//        student s1=new student("张三",18);
//        System.out.println(s1.name);
//        System.out.println("staticFunc()");

        System.out.println("aaaaaaa");

        {
            int a=10;
            //此代码块的执行不需要条件
            System.out.println("定义在方法内部的代码块！普通代码块！");
        }

    }

    public static void func2(){
        student.func();
        System.out.println("staticfunc()");
    }
}


public class test_11_10_0_2 {

//    public static void main(String[] args) {
//        student s1=new student("张三",10);
//        student s2=new student("李四",20);
//        student s3=new student("王五",30);
//
//        System.out.println("aaaaaaaaaa");
//    }


//    public static void main(String[] args) {
//        student s1=null;
//        //System.out.println(s1.name);
//        //error
//        System.out.println(student.classRoom);
//        System.out.println(s1.classRoom);
//    }


//    public static void main(String[] args) {
//        student s1=new student("张三",20);
//        s1.doclass();
//        s1.func();
//    }


//    public void mainStaticFunc(){
//
//    }
//    public static void main(String[] args) {
//        test_11_10_0_2 t=new test_11_10_0_2();
//        t.mainStaticFunc();
//        //mainStaticFunc();  error
//    }


//    public static void main(String[] args) {
//        student.func();
//    }


//    public static void main(String[] args) {
//        student.func();
//        System.out.println(student.getsize());
//    }


//    public static void main(String[] args) {
//        student s1=new student("张三",22);
//        System.out.println(s1.name);
//    }


    public static void main(String[] args) {
        //只要这个类被加载，静态代码块都会执行！！
        student s1=new student();
        System.out.println("-----------------");
        student s2=new student();
    }


}




